<?php
/**
 * Created by PhpStorm.
 * User: MrHung
 * Date: 8/9/14
 * Time: 4:30 PM
 */

class shareController extends Controller {

    public function index(){
        if(isset($_GET['share']) && $_GET['share'] != 'Fail'){

            $model = $this->loadModel('User');
            $title = $model->getOnePost($_GET['share']);
            $this->_view->title = $title[0]['post_details'];
            $this->_view->description = $title[0]['post_details'] ;
            $this->_view->category = $model->getAllCategory();
            $this->_view->addRight = $model->getAds('right');
            $this->_view->addleft = $model->getAds('left');
            $rs = $model->getOnePost($_GET['share']);
            $this->_view->data = $_GET['share'];
            $this->_view->render('index',null);

        }else{
            $_url = 'http://'.$_SERVER['HTTP_HOST'];
            header("Location: ".$_url);
        }
    }
} 